package com.aibaixun.web.controller.system;

import com.aibaixun.common.core.domain.R;
import com.aibaixun.system.domain.DicmAlarm;
import com.aibaixun.system.domain.dto.DicmAlarmPageDto;
import com.aibaixun.system.service.DicmAlarmService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 告警信息管理
 *
 * @author zhangyh
 * @date 2023-09-01
 **/
@RestController
@RequestMapping("/dicm/alarm" )
public class DicmAlarmController {

    @Autowired
    private DicmAlarmService dicmAlarmService;

    /**
     * 查询告警详情
     * @return
     */
    @ApiOperation(value = "查询告警详情")
    @GetMapping("/detail/{alarmId}")
    public R<DicmAlarm> getList(@PathVariable(value = "alarmId") String alarmId){
        return dicmAlarmService.getDetail(alarmId);
    }



    /**
     * 分页查询告警信息
     * @return
     */
    @ApiOperation(value = "分页查询告警信息")
    @PostMapping("/page")
    public R<Page<DicmAlarm>> getPage(@RequestBody DicmAlarmPageDto pageDto){
        Page page = new Page();
        page.setCurrent(pageDto.getCurrent());
        page.setSize(pageDto.getSize());
        page.setSearchCount(true);
        return dicmAlarmService.getPage(page, pageDto);
    }


}
